﻿function slideSwitch() {
    var $active = $('.multi-annonces-container .multi-annonces-item.active');

    if ($active.length == 0) $active = $('.multi-annonces-container .multi-annonces-item:last');

    var $next = $active.next().length ? $active.next()
        : $('.multi-annonces-container .multi-annonces-item:first');

    $active.addClass('last-active');

    $next.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, 1000, function () {
            $active.removeClass('active last-active');
        });
}